package cn.luna.service;
import java.io.Serializable;
import java.util.List;
/**
 * @author luna
 */
public interface BaseService<T> {
	/**
	 * Save an entity
	 * @param entity the entity to save
	 */
	void save(T entity);
	/**
	 * Update an entity
	 * @param entity the entity to update
	 */
	void update(T entity);
	/**
	 * Delete one or more entities
	 * @param ids the identifiers of the entities
	 */
	void delete(Serializable... ids);
	/**
	 * Find an entity base on the identifier of the entity
	 * @param id the identifier of the entity
	 * @return an entity
	 */
	T findById(Serializable id);
	/**
	 *  Find entities base on the JPQL
	 * @param jpql a JPQL string
	 * @param firstResult a row number, numbered from 0
	 * @param maxResult the maximum number of rows
	 * @param objects the values of the parameters
	 * @return list of result
	 */
	List<T> findByJpql(String jpql,int firstResult,int maxResult,Object... objects);
}
